package com.hxb.example.listener.flex;

import com.hxb.example.entity.BaseEntity;
import com.mybatisflex.annotation.InsertListener;

import java.time.LocalDateTime;

public class MyInsertListener implements InsertListener {
    @Override
    public void onInsert(Object entity) {
        if (entity instanceof BaseEntity baseEntity) {
            baseEntity.setCreateDate(LocalDateTime.now());
            baseEntity.setUpdateDate(LocalDateTime.now());
        }
    }
}
